import {createRouter,createWebHistory} from "vue-router";
export  default createRouter({
    //路由的模式的设置
    history:createWebHistory(),
    //管理路由
    routes:[
        {
            path:'/',
            redirect:'/home'
        },
        {
            path: '/home',
            component: () => import('@/views/home/Index.vue'),
            meta:{
                title:'首页'
            }
        },
        {
            path:'/hospital',
            component:() => import('@/views/hospital/index.vue'),
            children:[
                {
                    path:'close',
                    component:() => import('@/views/hospital/close/Close.vue'),
                    meta:{
                        title:'取消停诊信息'
                    }
                },
                {
                    path:'detail',
                    component:() => import('@/views/hospital/detail/Detail.vue'),
                    meta:{
                        title:'医院详情'
                    }
                },
                {
                    path:'notice',
                    component:() => import('@/views/hospital/notice/Notice.vue'),
                    meta:{
                        title:'预约通知'
                    }
                },
                {
                    path:'register',
                    component:() => import('@/views/hospital/register/Register.vue'),
                    meta:{
                        title:'预约挂号'
                    }
                },
                {
                    path:'search',
                    component:() => import('@/views/hospital/search/Search.vue'),
                    meta:{
                        title:'查询'
                    }
                },
                {
                    path:'register_step1',
                    component:()=> import('@/views/hospital/register/RegisterStep1.vue'),
                    meta:{
                        title:'预约的第一步'
                    }
                },
                {
                    path:'register_step2',
                    component:() => import('@/views/hospital/register/RegisterStep2.vue'),
                    meta:{
                        title:'预约的第二步'
                    }
                },
            ]
        },
        {
            path:'/wxlogin',
            component:()=>import('@/views/wxlogin/WXLogin.vue'),
            meta:{
                title:'微信登录'
            }
        },
        {
            path:'/user',
            component:()=>import('@/views/user/User.vue'),
            meta:{
                title:''

            },
            children:[
                {
                    path:'certification',
                    component:()=> import('@/views/user/certification/Certification.vue'),
                    meta:{
                        title:'实名认证'
                    }
                },
                {
                    path:'feedback',
                    component:()=>import('@/views/user/feedback/FeedBack.vue'),
                    meta:{
                        title:'意见反馈'
                    }
                },
                {
                    path:'order',
                    component:()=>import('@/views/user/order/Order.vue'),
                    meta:{
                        title:'挂号订单'
                    }
                },
                {
                    path:'patient',
                    component:()=>import('@/views/user/patient/Patient.vue'),
                    meta:{
                        title:'就诊人管理'
                    }
                },
                {
                    path:'profile',
                    component:()=>import('@/views/user/profile/Profile.vue'),
                    meta:{
                        title:'账号信息'
                    }
                }
            ]
        }
    ],
    //滚动行为，如果页面被滚动到下方的某个位置，路由切换后滚动条复位到指定位置
    scrollBehavior(){
        return{
            left:0,
            top:0
        }
    }
})